/**
 * 
 */
package com.thor.palmmall.rest.common;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.repair.AProcessRecord;
import com.thor.palmmall.spi.maintain.SProcessRecord;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SProcessRecordConverter implements Converter<AProcessRecord, SProcessRecord> {

  public static SProcessRecordConverter getInstance() {
    if (instance == null)
      instance = new SProcessRecordConverter();
    return instance;
  }

  private static SProcessRecordConverter instance;

  private SProcessRecordConverter() {
  }

  @Override
  public SProcessRecord convert(AProcessRecord source) {
    if (source == null) {
      return null;
    }
    SProcessRecord target = new SProcessRecord();
    target.setContent(source.getContent());
    target.setOperator(UCN.newInstance(source.getOperator()));
    target.setOperatorTime(source.getOperatorTime());
    return target;
  }

}
